package teacher.action.excel;

import java.util.List;

import teacher.bean.Patent;
import teacher.bean.Teacher;
import teacher.service.laohe.ListShow;
import teacher.service.PullPatentToExcel;

import com.opensymphony.xwork2.ActionContext;

public class excelPat {
	private int flag;
	private List<Patent> patents;
	public int getFlag() {
		return flag;
	}
	public void setFlag(int flag) {
		this.flag = flag;
	}
	public List<Patent> getPatents() {
		return patents;
	}
	public void setPatents(List<Patent> patents) {
		this.patents = patents;
	}
	public String execute()
	{
		Patent patent =new Patent();
		Teacher tea=(Teacher)ActionContext.getContext().getSession().get("teacher");
		if(flag==0)
		{
			patent.setExpClass(0);
			this.setPatents(new ListShow().getPatentByUser(patent, null, null, tea));
			new PullPatentToExcel().patentExcel2(this.getPatents());
		}
		if(flag==1)
		{
			patent.setExpClass(1);
			this.setPatents(new ListShow().getPatentByUser(patent, null, null, tea));
			new PullPatentToExcel().patentExcel2(this.getPatents());
		}
		if(flag==2)
		{
			patent.setExpClass(2);
			this.setPatents(new ListShow().getPatentByUser(patent, null, null, tea));
			new PullPatentToExcel().patentExcel2(this.getPatents());
		}
		return "succ";
	}
	
}
